package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.ProductSpecValuesMapper;
import com.ruoyi.mall.domain.ProductSpecValues;
import com.ruoyi.mall.service.IProductSpecValuesService;

/**
 * 商品规格值Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-13
 */
@Service
public class ProductSpecValuesServiceImpl implements IProductSpecValuesService 
{
    @Autowired
    private ProductSpecValuesMapper productSpecValuesMapper;

    /**
     * 查询商品规格值
     * 
     * @param specValueId 商品规格值主键
     * @return 商品规格值
     */
    @Override
    public ProductSpecValues selectProductSpecValuesBySpecValueId(Long specValueId)
    {
        return productSpecValuesMapper.selectProductSpecValuesBySpecValueId(specValueId);
    }

    /**
     * 查询商品规格值列表
     * 
     * @param productSpecValues 商品规格值
     * @return 商品规格值
     */
    @Override
    public List<ProductSpecValues> selectProductSpecValuesList(ProductSpecValues productSpecValues)
    {
        return productSpecValuesMapper.selectProductSpecValuesList(productSpecValues);
    }

    /**
     * 新增商品规格值
     * 
     * @param productSpecValues 商品规格值
     * @return 结果
     */
    @Override
    public int insertProductSpecValues(ProductSpecValues productSpecValues)
    {
        productSpecValues.setCreateTime(DateUtils.getNowDate());
        return productSpecValuesMapper.insertProductSpecValues(productSpecValues);
    }

    /**
     * 修改商品规格值
     * 
     * @param productSpecValues 商品规格值
     * @return 结果
     */
    @Override
    public int updateProductSpecValues(ProductSpecValues productSpecValues)
    {
        productSpecValues.setUpdateTime(DateUtils.getNowDate());
        return productSpecValuesMapper.updateProductSpecValues(productSpecValues);
    }

    /**
     * 批量删除商品规格值
     * 
     * @param specValueIds 需要删除的商品规格值主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecValuesBySpecValueIds(Long[] specValueIds)
    {
        return productSpecValuesMapper.deleteProductSpecValuesBySpecValueIds(specValueIds);
    }

    /**
     * 删除商品规格值信息
     * 
     * @param specValueId 商品规格值主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecValuesBySpecValueId(Long specValueId)
    {
        return productSpecValuesMapper.deleteProductSpecValuesBySpecValueId(specValueId);
    }
}
